function d = DivideRoots(fx, a, b, step)
fx = sym(fx);
a = double(sym(a));
b = double(sym(b));
f = inline(fx);
n = ShturmTheorem(fx, a, b);
d = zeros(n, 2);
l = a;
r = a + step;
i = 0;
while (i < n && l < b && r <= b)
    f0 = f(l) * f(r);
    if f0 < 0
        i = i + 1;
        while (l <= r - step)
            l = l + step;
            if f(l) * f(r) > 0
                l = l - step;
                break;
            end
        end;
        d(i, 1) = l;
        d(i, 2) = r;
        l = r;
    end
    r = r + step;
    if (r > b)
        r = b;
    end;
end;

if i < n
   d = DivideRoots(fx, a, b, step / 2); 
end

end

